package nz.ac.massey.doi_information_extractor.data;

public class Publication implements PublicationInterface{

	private String description;
	private String publicationType;
	private String pageNumbers;
	private String publicationTitle;
	private boolean qualityAssured;
	private boolean confidential;
	private boolean researchOrProfCom;
	private String volumeNumber;
	private String articleTitle;
	private String date;
	private String url;
	private String issn;
	private AuthorList authors;
	private int publicationId;
	private String publisher;
	private String doi;
	private String keywords;
	private String conferenceLocation;
	private String conferenceDates;
	private String publisherLocation;
	private String editors;
	// It's important to note that when the Publication is a journal, the edition field contains the issue number. 
	private String edition;
	private String journalNumber;
	private String rimsId;

	public Publication() {
		this.publicationId = -1;

		this.description = "";
		this.publicationType = "";
		this.pageNumbers = "";
		this.publicationTitle = "";
		this.qualityAssured = false;
		this.confidential = false;
		this.researchOrProfCom = false;
		this.volumeNumber = "";
		this.articleTitle = "";
		this.date = "";
		this.url = "";
		this.issn = "";
		this.authors = new AuthorList();
		this.publisher = "";
		this.keywords = "";
		this.conferenceLocation = "";
		this.conferenceDates = "";
		this.publisherLocation = "";
		this.editors = "";
		this.edition = "";
		this.journalNumber = "";
		this.rimsId = "";
	}

	/**
	 *
	 * @param publicationId the unique ID number for the publication
	 */
	public Publication(int publicationId) {
		this.publicationId = publicationId;

		this.description = "";
		this.publicationType = "";
		this.pageNumbers = "";
		this.publicationTitle = "";
		this.qualityAssured = false;
		this.confidential = false;
		this.researchOrProfCom = false;
		this.volumeNumber = "";
		this.articleTitle = "";
		this.date = "";
		this.url = "";
		this.issn = "";
		this.authors = new AuthorList();
		this.publisher = "";
		this.keywords = "";
		this.conferenceLocation = "";
		this.conferenceDates = "";
		this.publisherLocation = "";
		this.editors = "";
		this.edition = "";
		this.journalNumber = "";
	}

	/**
	 *
	 * @param description 	the description for the publication
	 * @param publicationType 	the type of contribution for the publication
	 * @param pageNumbers	the pages numbers of the publication in the corresponding journal
	 * @param publicationTitle	the title of the publication
	 * @param qualityAssured	whether the publication is quality assured or not
	 * @param confidential	whether the publication is confidential
	 * @param researchOrProfCom	whether the publication is Research or Professional/Community
	 * @param volumeNumber	the volume number for the publication
	 * @param articleTitle	the title for the article
	 * @param date	the date of publication
	 * @param url	the publications corresponding URL
	 * @param issn	the publication ISSN number
	 * @param staff	the staff who handed in the DOI
	 * @param authors the contributing authors to the publication
	 * @param publicationID the unique ID number for the publication
	 * @param publisher	the publisher of the publication
	 */
	public Publication(String description, String publicationType,
			String pageNumbers, String publicationTitle,
			boolean qualityAssured, boolean confidential,
			boolean researchOrProfCom, String volumeNumber,
			String articleTitle, String date, String url, String issn,
			AuthorList authors, String publisher, String keywords,
			String conferenceLocation, String conferenceDates,
			String publisherLocation, String editors, String journalEdition,
			String journalNumber, String doi, int publicationId, String rimsId) {

		this.description = description;
		this.publicationType = publicationType;
		this.pageNumbers = pageNumbers;
		this.publicationTitle = publicationTitle;
		this.qualityAssured = qualityAssured;
		this.confidential = confidential;
		this.researchOrProfCom = researchOrProfCom;
		this.volumeNumber = volumeNumber;
		this.articleTitle = articleTitle;
		this.date = date;
		this.url = url;
		this.issn = issn;
		this.authors = authors;
		this.publicationId = -1;
		this.publisher = publisher;
		this.keywords = keywords;
		this.conferenceLocation = conferenceLocation;
		this.conferenceDates = conferenceDates;
		this.publisherLocation = publisherLocation;
		this.editors = editors;
		this.edition = journalEdition;
		this.journalNumber = journalNumber;
		this.doi = doi;
		this.publicationId = publicationId;
		this.rimsId = rimsId;
	}


	public String getRimsId(){
		return rimsId;
	}

	public void setRimsId(String rimsId){
		this.rimsId = rimsId;
	}

	public String getJournalNumber(){
		return journalNumber;
	}

	public void setJournalNumber(String journalNumber){
		this.journalNumber = journalNumber;
	}

	public String getEdition(){
		return edition;
	}

	public void setEdition(String edition){
		this.edition = edition;
	}

	public String getEditors(){
		return editors;
	}

	public void setEditors(String editors){
		this.editors = editors;
	}

	public String getPublisherLocation(){
		return publisherLocation;
	}

	public void setPublisherLocation(String publisherLocation){
		this.publisherLocation = publisherLocation;
	}

	public String getConferenceDates(){
		return conferenceDates;
	}

	public void setConferenceDates(String conferenceDates){
		this.conferenceDates = conferenceDates;
	}

	public String getConferenceLocation(){
		return conferenceLocation;
	}

	public void setConferenceLocation(String conferenceLocation){
		this.conferenceLocation = conferenceLocation;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public String getPublicationType() {
		return publicationType;
	}

	public void setPublicationType(String contributionType) {
		this.publicationType = contributionType;
	}

	public String getPageNumbers() {
		return pageNumbers;
	}

	public void setPageNumbers(String string) {
		this.pageNumbers = string;
	}

	public String getPublicationTitle() {
		return publicationTitle;
	}

	public void setPublicationTitle(String publicationTitle) {
		this.publicationTitle = publicationTitle;
	}

	public boolean getQualityAssured() {
		return qualityAssured;
	}

	public void setQualityAssured(boolean qualityAssured) {
		this.qualityAssured = qualityAssured;
	}

	public boolean getConfidential() {
		return confidential;
	}

	public void setConfidential(boolean confidential) {
		this.confidential = confidential;
	}

	public boolean getResearchOrProfCom() {
		return researchOrProfCom;
	}

	public void setResearchOrProfCom(boolean researchOrProfCom) {
		this.researchOrProfCom = researchOrProfCom;
	}

	public String getVolumeNumber() {
		return volumeNumber;
	}

	public void setVolumeNumber(String volumeNumber){
		this.volumeNumber = volumeNumber;
	}

	public String getArticleTitle(){
		return articleTitle;
	}

	public void setArticleTitle(String articleTitle){
		this.articleTitle = articleTitle;
	}

	public String getDate(){
		return date;
	}

	public void setDate(String date){
		this.date = date;
	}

	public String getUrl(){
		return url;
	}

	public void setUrl(String url){
		this.url = url;
	}

	public String getIssn(){
		return issn;
	}

	public void setIssn(String issn){
		this.issn = issn;
	}

	public AuthorList getAuthors(){
		return authors;
	}

	public void setAuthors(AuthorList arrayList){
		this.authors = arrayList;
	}

	@Override
	public String getPublisher() {
		return publisher;
	}

	@Override
	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	@Override
	public String getDoi() {
		return doi;
	}

	@Override
	public void setDoi(String doi) {
		this.doi = doi;
	}

	public boolean equals(Publication publication){
		if(this == publication)
			return true;

		if(publication == null)
			return false;

		if(getClass() != publication.getClass())
			return false;

		if(doi.equals(publication.getDoi()))
			return true;

		return false;
	}

	public boolean equalsFull(Publication publication){
		if(this == publication)
			return true;

		if(publication == null)
			return false;

		if(getClass() != publication.getClass())
			return false;

		if(!articleTitle.equals(publication.getArticleTitle()))
			return false;

		if(!conferenceDates.equals(publication.getConferenceDates()))
			return false;

		if(!conferenceLocation.equals(publication.getConferenceLocation()))
			return false;

		if(confidential != publication.getConfidential())
			return false;

		if(!date.equals(publication.getDate()))
			return false;

		if(!description.equals(publication.getDescription()))
			return false;

		if(!doi.equals(publication.getDoi()))
			return false;

		if(!editors.equals(publication.getEditors()))
			return false;

		if(!issn.equals(publication.getIssn()))
			return false;

		if(!edition.equals(publication.getEdition()))
			return false;

		if(!journalNumber.equals(publication.getJournalNumber()))
			return false;

		if(!keywords.equals(publication.getKeywords()))
			return false;

		if(!pageNumbers.equals(publication.getPageNumbers()))
			return false;

		if(publicationId != publication.getPublicationId())
			return false;

		if(!publicationTitle.equals(publication.getPublicationTitle()))
			return false;

		if(!publicationType.equals(publication.getPublicationType()))
			return false;

		if(!publisher.equals(publication.getPublisher()))
			return false;

		if(!publisherLocation.equals(publication.getPublisherLocation()))
			return false;

		if(qualityAssured != publication.getQualityAssured())
			return false;

		if(researchOrProfCom != publication.getResearchOrProfCom())
			return false;

		if(!url.equals(publication.getUrl()))
			return false;

		if(!volumeNumber.equals(publication.getVolumeNumber()))
			return false;

		return true;
	}

	public void setPublicationId(int publicationID) {
		this.publicationId = publicationID;
	}

	@Override
	public int getPublicationId() {
		return publicationId;
	}
}
